From: Lukáš Tyrychtr Date: Tue, 1 Nov 2022 15:54:54 +0000 (+0100) Subject: popupMenu: Allow to use the up and down arrows to wrap around X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~320^2^2~15 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c97825e832b0eedfea7ea2866373383c49e8386a;p=gnome-shell.git popupMenu: Allow to use the up and down arrows to wrap around This aligns the keyboard navigation behavior with similar menus in other desktop environments and with GTK itself. It allows the users to move in the menu using already known patterns and makes the operation quicker in some cases, especially as many users don't know about the tab and shift+tab behavior. Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6017 Part-of: --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 531753161..60da5460d 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -167,6 +167,16 @@ export const PopupBaseMenuItem = GObject.registerClass({ this.activate(event); return Clutter.EVENT_STOP; } + + // Support wrapping navigation in the menu + if (symbol === Clutter.KEY_Up || symbol === Clutter.KEY_Down) { + const group = global.focus_manager.get_group(this); + const direction = symbol === Clutter.KEY_Up + ? St.DirectionType.UP + : St.DirectionType.DOWN; + if (group?.navigate_focus(this, direction, true)) + return Clutter.EVENT_STOP; + } return Clutter.EVENT_PROPAGATE; }